Skip to content

[feat] ensure conversion hooks#790

Merged
ldmonster merged 2 commits into
mainfrom
feature/ensure-conversion-hooks
Jul 8, 2026
Merged

[feat] ensure conversion hooks#790
ldmonster merged 2 commits into
mainfrom
feature/ensure-conversion-hooks

Conversation

@Fkuloff

@Fkuloff Fkuloff commented Jul 2, 2026

Copy link
Copy Markdown
Contributor

Overview

Forward-ports the "ensure conversion hooks" feature to main. It shipped to release-1.21 in #783 but is missing on main; this brings main in line. Cherry-pick (-x) of 04ede3b — applied conflict-free on current main (3-way auto-merge), go build ./... and go vet pass.

What this PR does / why we need it

Adds a module-ensure-hooks task that applies a module's ConversionWebhook resources before its Helm release, and wires it into the module converge lifecycle (module_manager, converge-modules, task service, task.go). This lets the cluster's webhook-handler patch the target CRDs' spec.conversion before the module creates custom resources that need converting — otherwise the API server stores those resources before conversion is live and prunes the old-version fields.

Special notes for your reviewer

Straight forward-port of #783; no changes beyond the conflict-free cherry-pick onto main. Original author: Stepan Paksashvili.

@Fkuloff Fkuloff self-assigned this Jul 2, 2026
@Fkuloff Fkuloff requested a review from ipaqsa July 2, 2026 12:00
@Fkuloff Fkuloff added the enhancement New feature or request label Jul 2, 2026
@Fkuloff Fkuloff requested a review from ldmonster July 2, 2026 13:14
@Fkuloff Fkuloff marked this pull request as ready for review July 2, 2026 13:14
@ldmonster ldmonster requested a review from Copilot July 6, 2026 10:29

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR forward-ports the “ensure conversion hooks” feature to main by introducing a new converge task that applies a module’s ConversionWebhook resources before its Helm release runs, so CRD conversion is in place before custom resources are created.

Changes:

  • Adds a new ModuleEnsureHooks task (module-ensure-hooks) and wires it into the task handler service.
  • Queues ModuleEnsureHooks during module converge (before ModuleRun) when the module is detected to contain conversion webhook templates.
  • Implements webhook detection (static heuristic at module load), rendering (filter rendered manifests by kind: ConversionWebhook), and applying (CreateOrUpdate via KubeObjectPatcher) in the module manager.

Reviewed changes

Copilot reviewed 10 out of 10 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
pkg/task/tasks/module-ensure-hooks/task.go New task handler that triggers EnsureConversionWebhooks for a module.
pkg/task/tasks/converge-modules/task.go Enqueues the new ensure-hooks task in the converge pipeline and adds a helper constructor.
pkg/task/task.go Adds the new ModuleEnsureHooks task type constant.
pkg/task/service/service.go Registers the new task handler in the task factory map.
pkg/task/helpers/helpers.go Updates task-details formatting to include ModuleEnsureHooks.
pkg/module_manager/module_manager.go Adds EnsureConversionWebhooks and ModuleHasConversionWebhooks to render/apply webhook resources.
pkg/module_manager/models/modules/helm.go Adds webhook rendering helper that filters rendered YAML docs by ConversionWebhook kind.
pkg/module_manager/models/modules/basic.go Adds a static “templates contain ConversionWebhook” heuristic computed on module load.
pkg/addon-operator/operator.go Updates task-details formatting to include ModuleEnsureHooks.
pkg/addon-operator/converge/converge.go Treats ModuleEnsureHooks as a converge task type.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread pkg/module_manager/module_manager.go
Comment thread pkg/task/tasks/converge-modules/task.go Outdated
ipaqsa and others added 2 commits July 7, 2026 12:54
Signed-off-by: Stepan Paksashvili <stepan.paksashvili@flant.com>
(cherry picked from commit 04ede3b)
Signed-off-by: Artem Kuleshov <artem.kuleshov@flant.com>
@Fkuloff Fkuloff force-pushed the feature/ensure-conversion-hooks branch from fd263fc to ab32f52 Compare July 7, 2026 09:55
@ldmonster ldmonster merged commit 01a2165 into main Jul 8, 2026
8 of 9 checks passed
@ldmonster ldmonster deleted the feature/ensure-conversion-hooks branch July 8, 2026 10:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants